<div class="row" style="margin-bottom: 20px; margin-top: -15px;">
    <div class="col-sm-12">
        <h3>
        	<i class="fa fa-edit" style="color:<?php echo $color?>"></i> <?php echo $title?>
        </h3>
    </div>
</div>
<div class="row">
	<div class="col-sm-12">
		<form action="<?php echo base_url('admin/film/edit').'/'.$result['idphim'];?>" id="frm_Film_New" class="form-horizontal" method="post">
			<div class="form-group <?php if(form_error('name') != NULL){echo 'has-error';}?>">
                <label for="subject" class="col-sm-2 control-label">
                   Name <span style="color: red;">*</span>
                </label>
                <div class="col-sm-10" style="padding-left:5px;">
                    <input type="text" class="form-control" placeholder="Name film" name="name" value = "<?php if(isset($result['name'])){echo $result['name'];}else{echo set_value('name');}?>">
                	<?php echo form_error('name','<p class="help-block">','</p>');?>
                </div>
            </div>

            <div class="form-group <?php if(form_error('name_en') != NULL){echo 'has-error';}?>">
                <label for="subject" class="col-sm-2 control-label">
                   English name  <span style="color: red;">*</span>
                </label>
                <div class="col-sm-10" style="padding-left:5px;">
                    <input type="text" class="form-control" placeholder="Name film" name="name_en" value = "<?php if(isset($result['name_en'])){echo $result['name_en'];}else{echo set_value('name_en');};?>">
                    <?php echo form_error('name_en','<p class="help-block">','</p>');?>
                </div>
            </div>

            <div class="row">
                <div class="col-sm-6 form-group <?php if(form_error('director') != NULL){echo 'has-error';}?>" >
                    <label for="subject" class="col-sm-4 control-label">
                      Director 
                    </label>
                    <div class="col-sm-8">
                        <input type="text" class="form-control" name="director" value="<?php if(isset($result['director'])){ echo $result['director']; }else{ echo set_value('director');} ?>">
                        <?php echo form_error('director','<p class="help-block">','</p>');?>
                    </div>
                </div>
                <div class="col-sm-6 form-group <?php if(form_error('actor') != NULL){echo 'has-error';}?>" >
                    <label for="subject" class="col-sm-4 control-label">
                       Actor/Actress
                    </label>
                    <div class="col-sm-8">
                        <input type="text" class="form-control" name="actor" value="<?php if(isset($result['actor'])){echo $result['actor'];}else{ echo set_value('actor');}?>">
                        <?php echo form_error('actor','<p class="help-block">','</p>');?>
                    </div>
                </div>
            </div>
            
            <div class="row">
                <div class="col-sm-6 form-group <?php if(form_error('meta') != NULL){echo 'has-error';}?>" >
                    <label for="subject" class="col-sm-4 control-label">
                       Seo keyword  <span style="color: red;">*</span>
                    </label>
                    <div class="col-sm-8">
                        <textarea class="form-control" name="meta" id=""  rows="5"><?php if(isset($result['keywords'])){echo UnHtmlChars($result['keywords']); }else{ echo set_value('meta') ; } ?></textarea>
                        <?php echo form_error('meta','<p class="help-block">','</p>');?>
                    </div>
                </div>
                <div class="col-sm-6 form-group <?php if(form_error('description') != NULL){echo 'has-error';}?>" >
                    <label for="subject" class="col-sm-4 control-label">
                       Description <span style="color: red;">*</span>
                    </label>
                    <div class="col-sm-8">
                        <textarea class="form-control" name="description" id=""  rows="5"><?php if(isset($result['description'])){ echo UnHtmlChars($result['description']);}else{echo set_value('description');}?></textarea>
                        <?php echo form_error('description','<p class="help-block">','</p>');?>
                    </div>
                </div>
            </div>

			<div class="form-group ">
                <label class="col-sm-2 control-label" for="subject">Category</label>
                <div class="col-sm-10">
                    <?php if($result_cate != NULL){ foreach($result_cate as $value):?>
                        <label class="control-label" style="margin-left:10px;"><?php echo $value['namecate']?></label>
                        <input type="checkbox" <?php if(!empty($check_cate[$value['idcate']])){echo $check_cate[$value['idcate']];}?> name="category[]" value="<?php echo $value['idcate'];?>" >
                    <?php endforeach; } ?>
                </div>
            </div>

            <div class="row">
                <div class="form-group col-sm-6">
                    <label class="col-sm-4 control-label" for="subject">Country</label>
                    <div class="col-sm-8">
                        <select name="country" id="" class="form-control  chosen-select">
                            <?php if(!empty($result_country)){ foreach($result_country as $value):?>
                                <option <?php if($result['country'] == $value['idcountry']){echo 'selected=""';}?> value="<?php echo $value['idcountry']?>"><?php echo $value['namecountry']?></option>
                            <?php endforeach; } ?>
                        </select>
                    </div>
                </div>
                <div class="form-group col-sm-6 <?php if(form_error('film_year') != NULL){echo 'has-error';}?>" >
                    <label class="col-sm-4 control-label" for="subject">Public year</label>
                    <div class="col-sm-8">
                        <div class="input-group" id="datetimepicker10">
                            <div class="input-group-addon">
                                <i class="fa fa-calendar"></i>
                            </div>
                            <input type="text" class="form-control pull-right"  name="film_year" value="<?php if(isset($result['film_year'])){ echo $result['film_year']; }else{echo set_value('film_year');} ?>">
                        </div>
                        <?php echo form_error('film_year','<p class="help-block">','</p>');?>
                    </div>
                </div>
            </div>
            
            <div class="row">
                <div class="form-group col-sm-6">
                    <label class="col-sm-4 control-label" for="subject">Duration</label>
                    <div class="col-sm-8">
                        <input type="text" name="duration" class="form-control" value="<?php if(isset($result['duration'])){ echo $result['duration'];}else{echo set_value('duration');}?>" >
                         <?php echo form_error('duration','<p class="help-block">','</p>');?>
                    </div>
                </div>
                <div class="form-group col-sm-6">
                    <label class="col-sm-4 control-label" for="subject">Type</label>
                    <div class="col-sm-8">
                        <select name="option_film" id="" class="form-control">
                            <option <?php if($result['option_film'] == 1){echo 'selected=""';}?> value="1">Single film</option>
                            <option <?php if($result['option_film'] == 2){echo 'selected=""';}?> value="2">OVA</option>
                            <option <?php if($result['option_film'] == 3){echo 'selected=""';}?> value="3">Cartoon</option>
                            <option <?php if($result['option_film'] == 4){echo 'selected=""';}?> value="4">Full episode</option>
                            <option <?php if($result['option_film'] == 5){echo 'selected=""';}?> value="5">Unfulfilled episode</option>
                        </select>
                    </div>
                </div>
            </div>
            
            <div class="row">
                <div class="form-group col-sm-6 <?php if(form_error('thumb') != NULL){echo 'has-error';}?>">
                    <label class="col-sm-4 control-label" for="subject">Film screenshot  <span style="color: red;">*</span> </label>
                    <div class="col-sm-8">
                        <input type="text" name="thumb" value="<?php if(isset($result['thumb'])){echo $result['thumb'];}else{ echo set_value('thumb');}?>" class="form-control">
                        <?php echo form_error('thumb','<p class="help-block">','</p>');?>
                    </div>
                </div>
                <div class="form-group col-sm-6 <?php if(form_error('big_thumb') != NULL){echo 'has-error';}?>">
                    <label class="col-sm-4 control-label" for="subject">Banner<span style="color: red;">*</span> </label>
                    <div class="col-sm-8">
                        <input type="text" name="big_thumb" value="<?php if(isset($result['big_thumb'])){echo $result['big_thumb'];}else{ echo set_value('big_thumb');}?>" class="form-control">
                        <?php echo form_error('big_thumb','<p class="help-block">','</p>');?>
                    </div>
                </div>
            </div>
            
            <div class="row">
                <div class="form-group col-sm-6">
                    <label class="col-sm-4 control-label" for="subject">Quality</label>
                    <div class="col-sm-8">
                        <input type="text" value="<?php if(isset($result['quaylity'])){ echo $result['quaylity'];}else{echo set_value('quaylity');} ?>" name="quaylity" class="form-control">
                        <?php echo form_error('quaylity','<p class="help-block">','</p>');?>
                    </div>
                </div>
                <div class="form-group col-sm-6">
                    <label class="col-sm-4 control-label" for="subject">Trailer</label>
                    <div class="col-sm-8">
                        <input type="text" name="trailer" value="<?php if(isset($result['trailer'])){ echo $result['trailer'];}else{echo set_value('trailer');} ?>" class="form-control">
                        <?php echo form_error('trailer','<p class="help-block">','</p>');?>
                    </div>
                </div>
            </div>
            
            <div class="form-group ">
                <label class="col-sm-2 control-label" for="subject">Award</label>
                <div class="col-sm-10">
                    <label class="control-label" style="margin-left:10px;">Nominate Film </label>
                    <input type="checkbox" <?php if($result['decu'] == 1){ echo 'checked = ""';}?> name="decu" value="1" >
                    <label class="control-label" style="margin-left:10px;">Hot Film</label>
                    <input type="checkbox" <?php if($result['hot'] == 1){ echo 'checked = ""';}?> name="hot" value="1" >
                </div>
            </div>
                
            <div class="form-group <?php if(form_error('content') != NULL){echo 'has-error';}?> " >
                <label class="col-sm-2 control-label" for="subject">Content <span style="color: red;">*</span> </label>
                <div class="col-sm-10">
                    <textarea name="content" id="content-film" cols="30" rows="10"><?php if(isset($result['content'])){ echo UnHtmlChars($result['content']);}else{echo set_value('content');} ?></textarea>
                    <?php echo form_error('content','<p class="help-block">','</p>');?>
                </div>
            </div>
           
            <div class="form-group ">
                <label class="col-sm-2 control-label" for="subject">Tags  <span style="color: red;">*</span> </label>
                <div class="col-sm-10">
                  <input type="text" id="tags" name="tags" value="<?php if(isset($tags_result)){ echo $tags_result['tag'];}else{echo set_value('tags');}?>" class="form-control" placeholder="Add tags" data-role="tagsinput">
                </div>
            </div>
            
            <div class="form-group <?php if(form_error('search') != NULL){echo 'has-error';}?> ">
                <label class="col-sm-2 control-label" for="subject">Search keyword<span style="color: red;">*</span> </label>
                <div class="col-sm-10">
                    <textarea name="search" cols="125" rows="3"><?php if(isset($search)){ echo $search; }else{ echo set_value('search');}?></textarea>
                    <?php echo form_error('search','<p class="help-block">','</p>');?>
                </div>
            </div>

			<div class="form-group ">
                <label class="col-sm-2 control-label" for="subject">Active</label>
                <div class="col-sm-10">
	                <input type="checkbox" checked="" name="status" value="1">
	            </div>
            </div>
		</form>
	</div>
</div>
<script>
	jQuery(document).ready(function($) {
		$('.btn-index').css({display:'none'});
        $('.btn-edit').css({display:'inline-block'});
        $('.btn-copy').css({display:'none'});
        $('.btn-add').css({display:'none'});
        $('.content input[type="checkbox"]').iCheck({checkboxClass: 'icheckbox_minimal'});
        $('.content input[type="radio"]').iCheck({radioClass: 'iradio_minimal'});
        //chonsen select
        $('.chosen-select').chosen();
        //time js
        $('#datetimepicker10').datetimepicker({
            viewMode: 'years',
            format: 'YYYY'
        });
        //tags input
        $("#tags").tagsinput('items');
	});
    //ckeditor
    $(function() {
        // Replace the <textarea id="editor1"> with a CKEditor
        // instance, using default configuration.
        CKEDITOR.replace('content-film');
    });
 
	function Edit(){
        $(".content").mask("<?php echo 'Loading...'; ?>");
        $("#frm_Film_New").submit();
    }

    function back_to_list(){
    	$(".content").mask("<?php echo 'Loading...'; ?>");
    	var url = '<?php echo base_url("admin/film");?>';
        window.location.href = url;
    }
</script>